 <div id="maincontent">
	<div id="maincontent_inner">
		<div id="sidebar">
			<div class="menu single">
				<ul>
					<li><a href="#">车辆基础信息库管理</a>
						<ul>
							<li class="current"><a href="<?php echo site_url("c=car_info&m=index"); ?>">车辆信息管理</a></li>
							<li><a href="<?php echo site_url("c=car_brand&m=index"); ?>">车辆品牌管理</a></li>
							<li><a href="<?php echo site_url("c=car_series&m=index"); ?>">车辆系列管理</a></li>
							<li><a href="<?php echo site_url("c=car_type&m=index"); ?>">车辆类型管理</a></li>
							<li><a href="<?php echo site_url("c=car_structure&m=index"); ?>">车辆结构管理</a></li>
						</ul>
					</li>
				</ul>
			</div>
		</div>
		<div id="content">
			<div class="title">车辆信息管理</div>
			<div class="infoarea">
				<form name="titleSearchForm" action="<?php echo site_url("c=car_info&m=index"); ?>" method="post">
				<div class="box">
				
				车辆名称：<input type="text" size="16" name="carname" value="<?php echo $params['carname']; ?>"/> 
				
				品牌：<select id="brandid" name="brandid"> 
				<option value="0"  >-----选择-----</option>

				 <?php 
				if($brandlist)
				{
					foreach($brandlist as $brand){ 
						if($params['brandid']==$brand['brandid'])
						{
						?>
						<option selected value="<?php echo $brand['brandid']; ?>"><?php echo $brand['brandname']; ?></option>
						 <?php }else{ ?>
						 <option value="<?php echo $brand['brandid']; ?>"><?php echo $brand['brandname']; ?></option>
						<?php 
						}
					}
				}
				 ?>
					</select>	
				车系：
				<select id="seriesid" name="seriesid"> 
					<option value="0"  >-----选择-----</option>
				</select>	
				<input type="submit" class="btn" value="查询"/>
				
				<div style="float:right"><input type="button" class="btn" value="添加车辆信息" onclick="gotoPage('<?php echo site_url("c=car_info&m=add"); ?>');" /></div>
				
				</form>
				</div>
				<table border="0" cellspacing="0" cellpadding="0" width="100%" class="stylized">
					<tr>
						<th>车辆名称</th>
						<th>所属车系</th>
						<th>所属品牌</th>
						<th>操作</th>
					</tr>
					 <?php 
					if($count)
					{
					foreach($list as $car){ ?>
					<tr>
						<td><?php echo $car['carname']; ?></td>
						<td><?php echo $car['brandname']; ?></td>
						<td><?php echo $car['seriesname']; ?></td>
						 
						<td>  <a href="<?php echo site_url("c=car_info&m=edit&carid=$car[carid]"); ?>">编辑</a> | <a href="<?php echo site_url("c=car_info&m=delete&carid=$car[carid]"); ?>" onclick="return confirm('确认要删除当前记录吗？')">删除</a></td>
					</tr>
					 <?php }
					}
					else
					{?>

					<tr>
						<td colspan="4"> 无记录 </td>
					</tr>
					 <?php  
					}
					 ?>
 
					 
				</table>
				<div id="pager" class="pagebar">
					 <?php  
					 echo $pagelink;
					 ?>
					
				</div>
			</div>
		</div>
	</div>
</div>
 

 

<script type="text/javascript">
var seriesList = new Array();
var defaultBrandId ='<?php echo $params['brandid']?>';
var defaultSeriesId ='<?php echo $params['seriesid']?>';
var idx=0;
 <?php  

 if($serieslist)
 {

	foreach($serieslist as $brandid => $seriesgroup)
	{
		echo "seriesList['".$brandid."'] = new Array();\r\n";
		echo "idx=0;\r\n";
		foreach($seriesgroup as $series)
		{
			echo "seriesList['".$brandid."'][idx++] = new Array('".$series['seriesname']."','".$series['seriesid']."','".$series['brandid']."');\r\n";
		}
	}
 }
 ?>
 
function changeSeries()
{
	var seriesObj = $('#seriesid');
	var strhtml='<option value="0"  >-----选择-----</option>';
	var brandId =  $('#brandid').val();

	$('#seriesid option').remove();  

	if(seriesList[brandId])
	{
		optionArr = seriesList[brandId];
		for(idx=0;idx<optionArr.length;idx++)
		{
			if(defaultSeriesId == optionArr[idx][1])
			{
				strhtml += "<option selected value=\""+optionArr[idx][1]+"\">" +optionArr[idx][0]+"</option>";
			}
			else
			{
				strhtml += "<option value=\""+optionArr[idx][1]+"\">" +optionArr[idx][0]+"</option>";
			}
		}
	}
	seriesObj.append(strhtml);
}

$(document).ready(function(){
	$('#brandid').bind({
	  change: function() {
		changeSeries();
	  }
	 });
   changeSeries();
});
</script>